package queue

import (
	"context"
	"github.com/thoas/bokchoy"
	"log"
)

var (
	Ctx    context.Context
	Engine *bokchoy.Bokchoy
)

func init() {
	ctx := context.Background()

	// define the main engine which will manage queues
	engine, err := bokchoy.New(ctx, bokchoy.Config{
		Broker: bokchoy.BrokerConfig{
			Type: "redis",
			Redis: bokchoy.RedisConfig{
				Type: "client",
				Client: bokchoy.RedisClientConfig{
					Addr: "localhost:6379",
				},
			},
		},
	})
	if err != nil {
		log.Fatal(err)
	}

	Engine = engine
	Ctx = ctx
}
